﻿
export default function (el, contain) {
    el.addEventListener('touchstart', function () {
        var  top = el.scrollTop;
        console.log(el.scrollTop)
        var totalScroll = el.scrollHeight;
        var  currentScroll = top + el.offsetHeight;

        if (top === 0) {
            el.scrollTop = 1;
        } else if (currentScroll === totalScroll) {
            el.scrollTop = top - 1;
        }
    });
    el.addEventListener('touchmove', function (evt) {
        //if the content is actually scrollable, i.e. the content is long enough
        //that scrolling can occur
        if (el.offsetHeight < el.scrollHeight) {
            evt._isScroller = true;
        }
    });
    // overscroll(document.querySelector('.scroll'));
    contain.addEventListener('touchmove', function (evt) {
        //In this case, the default behavior is scrolling the body, which
        //would result in an overflow.  Since we don't want that, we preventDefault.
        if (!evt._isScroller) {
            evt.preventDefault();
        }
    });
  
}

//export default Limit_scroll_for_thom;
